﻿<UserControl x:Class="MVVM.Views.OpenQuestionView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
    xmlns:prism="http://www.codeplex.com/prism" 
    xmlns:GuidanceTools="clr-namespace:Microsoft.Practices.Prism.GuidanceTools;assembly=Microsoft.Practices.Prism.GuidanceTools" 
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid Margin="5" d:DesignWidth="431" d:DesignHeight="353">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Question.QuestionText}" Style="{StaticResource QuestionLabelStyle}"/>
        <GuidanceTools:InfoTipToggleButton Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left">
            <StackPanel MinWidth="100" MinHeight="24" MaxWidth="400">
                <TextBlock TextWrapping="Wrap">This is an Open Question, any character is allowed.</TextBlock>
                <TextBlock TextWrapping="Wrap"> • The OpenQuestionView binds to the AvailableLength property from the OpenQuestionViewModel to show the remaining characters.</TextBlock>
                <TextBlock TextWrapping="Wrap"> • The UpdateSourceTrigger="PropertyChanged" is used to update the binding whenever a new character is entered.</TextBlock>
            </StackPanel>
        </GuidanceTools:InfoTipToggleButton>
        <TextBox Grid.Row="1" Grid.ColumnSpan="2" MinHeight="50"
                 MaxLength="{Binding Question.MaxLength}"
                 Text="{Binding Question.Response, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" AutomationProperties.AutomationId="OpenQuestionAutomationId">            
        </TextBox>
        <TextBlock Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Right"><Run Text="{Binding AvailableLength}"/><Run Text=" chars remaining"/></TextBlock>
    </Grid>
</UserControl>
